package demo5;

public class Test {

    public static void eat(Animal animal) {
        animal.eat();
    }

    public static void running(IRunable runable) {
        runable.run();
    }

    public static void flying(IFLyable ifLyable) {
        ifLyable.fly();
    }

    public static void swimming(ISwimable iSwimable) {
        iSwimable.swim();
    }

    public static void main(String[] args) {
        Object obj = new Dog("旺财",10);

        Object str = "hello";
        Object a = 10;
    }

    public static void main2(String[] args) {
        Dog dog = new Dog("旺财",10);
        Bird bird = new Bird("啾啾",2);
        Fish fish = new Fish("小鱼儿",3);

        running(dog);
        running(bird);
        System.out.println("===========");
        flying(bird);
        System.out.println("===========");
        swimming(dog);
        swimming(fish);

        System.out.println("===========");

        Robot robot = new Robot();
        running(robot);

    }

    public static void main1(String[] args) {
        Dog dog = new Dog("旺财",10);
        Bird bird = new Bird("啾啾",2);

        eat(dog);
        eat(bird);

    }
}
